<?php //dmy

require_once ('BaseService.php');

//Done.
/**
 * @author Virtualidad
 * @version 1.0
 * @created 29-dic-2010 09:57:49 a.m.
 */
class CursosService extends BaseService {

    function GetByMateria($codigoMateria) {
        $response = parent::invokeService("GetByMateria", $codigoMateria);
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());
        return $result;
    }

    /**
     *
     * @return array 
     */
    function GetAll() {
        $response = parent::invokeService("GetAll");
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());
        return $result;
    }

    function GetByDocente($nit) {
        $response = parent::invokeService("GetByDocente", $nit);
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());
        return $result;
    }

    /**
     *
     * @param CursoPK $Id
     * @return <type>
     */
    public function GetById(CursoPk $CursoPk) {
        $encoder = parent::getSerializer(parent::getMimeType(), "CursoPK");
        $id = $encoder->serialize($CursoPk);
        $response = parent::invokeService("GetById", $id);

        Loader::using("models::entities::Cursos");
        $result = parent::processSingleObjectResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());

        return $result;
    }

    /**
     *
     * @param PeriodoAcademico $PeriodoAcademico
     * @return <type> 
     */
    public function GetByPeriodoAcademico(PeriodoAcademico $PeriodoAcademico) {
        $encoder = parent::getSerializer(parent::getMimeType(), "PeriodoAcademico");
        $periodo = $encoder->serialize($PeriodoAcademico);
        $response = parent::invokeService("GetCursoByPeriodoAcademico", $periodo);

        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());

        return $result;
    }

    /**
     *
     * @param PeriodoAcademico $PeriodoAcademico
     * @param int $CodigoPlan
     * @return <type>
     */
    public function GetByPeriodoAcademicoAndPlanEstudio($PeriodoAcademico,
            $CodigoPlan) {
        $encoder = parent::getSerializer(parent::getMimeType(), "PeriodoAcademico");
        $periodo = $encoder->serialize($PeriodoAcademico);
        $data = $encoder->wrapArray(array(
                    "CodigoPlan" => $CodigoPlan,
                    "PeriodoAcademico" => $PeriodoAcademico
                        ), "GetByPeriodoAcademicoAndPlanEstudio"); //<--A root for potential xml support

        $response = parent::invokeService("GetByPeriodoAcademicoAndPlanEstudio", $data);
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());

        return $result;
    }

    /**
     *
     * @param int $CodigoEstudiante
     * @param PeriodoAcademico $PeriodoAcademico
     * @return array<Cursos>
     */
    public function GetByEstudianteAndPeriodoAcademico($CodigoEstudiante,
            $PeriodoAcademico) {
        $encoder = parent::getSerializer(parent::getMimeType(), "PeriodoAcademico");
        $periodo = $encoder->serialize($PeriodoAcademico);
        $data = $encoder->wrapArray(array(
                    "CodigoEstudiante" => $CodigoEstudiante,
                    "PeriodoAcademico" => $periodo
                        ), "GetByEstudianteAndPeriodoAcademico"); //<--A root for potential xml support
        $response = parent::invokeService("GetByEstudianteAndPeriodoAcademico", $data, true);
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());
        return $result;
    }
    
    public function GetHabilitados(PeriodoAcademico $periodo) {
        $encoder = parent::getSerializer(parent::getMimeType(), "PeriodoAcademico");
        $data = $encoder->serialize($periodo);
        
        $response = parent::invokeService("GetHabilitados", $data);
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());
        return $result;
    }

    public function CargarPreMatricula(PeriodoAcademico $periodo){
        $encoder = parent::getSerializer(parent::getMimeType(), "PeriodoAcademico");
        $data = $encoder->serialize($periodo);
        
        $response = parent::invokeService("CargarPreMatricula", $data);
        Loader::using("models::entities::Cursos");
        $result = parent::processArrayResponse($response, parent::getMimeType(), "Cursos", Cursos::MAPPING());
        return $result;
    }
    
    public function GetCreditosPagados(PeriodoAcademico $periodo) {
        $encoder = parent::getSerializer(parent::getMimeType(), "PeriodoAcademico");
        $data = $encoder->serialize($periodo);
        
        $response = parent::invokeService("GetCreditosPagados", $data);
        return $response;
    }

    public function getServiceClass() {
        return "Cursos";
    }

}

?>